﻿<%@ Page Title="Posts" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Posts_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phActions" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phSubMenu" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="phMain" Runat="Server">
    
    <script type="text/javascript">
        function ContextMenuClicked(sender, args) {
            var selversion = $get("<%= listVersion.ClientID%>");
            if (selversion && args.get_menuItem() && args.get_menuItem()._linkElement && args.get_menuItem()._linkElement.href)
                args.get_menuItem()._linkElement.href += "?Id=" + args.get_node().get_value() + "&SV=" + selversion.value;
        }
    </script>
    <acms:Columns ID="colsPosts" IncludeShadow="false" runat="server">
        <acms:DoubleColumn ID="colLeft" runat="server">
            <h3>Manage Posts</h3>
            <p>To create a post select the pending version of the tree, and find the parent and right click on that and select "add child" or "add sibling".</p>
            <ul>
                <li>Select a post bellow to view, edit move or publish. We recommend that you edit pending posts and then publish them rather than editing live posts.</li>
                <li>To create a post select the pending version of the tree, and find the parent and right click on that and select "add child" or "add sibling".</li>
            </ul>
            <asp:Panel ID="pnlPublishKey" CssClass="key" runat="server">
                <span class="publishNormal">= Publishing not required,</span>
                <span class="publishReady">= Marked Ready for Publishing,</span>
                <span class="publishRequired">= Post has changed and requires Publishing</span>
            </asp:Panel>
            Site Version :
            <asp:DropDownList ID="listVersion" runat="server" AppendDataBoundItems="True" 
                AutoPostBack="True" ondatabinding="listVersion_DataBinding" 
                ondatabound="listVersion_DataBound" 
                onselectedindexchanged="listVersion_SelectedIndexChanged">
            </asp:DropDownList>
            <br />
            <telerik:RadTreeView ID="tvSiteMap" runat="server" DataSourceID="dsSiteMap" 
                ondatabinding="tvSiteMap_DataBinding" 
                OnContextMenuItemClick="tvSiteMap_ContextMenuItemClick"
                ondatabound="tvSiteMap_DataBound" OnNodeDataBound="tvSiteMap_NodeDataBound">
                <contextmenus>
                    <telerik:RadTreeViewContextMenu ID="RadTreeViewContextMenu1" runat="server">
                        <collapseanimation duration="200" type="OutQuint" />
                        <Items>
                            <telerik:RadMenuItem runat="server" NavigateUrl="~/Posts/Details.aspx" Text="View \ Edit" Value="Details">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" NavigateUrl="~/Posts/Create.aspx" Text="Add Child" Value="AddChild">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" NavigateUrl="~/Posts/Create.aspx" Text="Add Sibling" Value="AddSibling">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" Text="Copy" Value="Copy">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" Text="Publish" Value="Publish">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" Text="Position" Value="Position">
                            </telerik:RadMenuItem>
                        </Items>
                    </telerik:RadTreeViewContextMenu>
                </contextmenus>
                <collapseanimation duration="100" type="OutQuint" />
                <expandanimation duration="100" />
                <DataBindings>
                    <telerik:RadTreeNodeBinding TextField="DisplayName" ValueField="Id" ToolTipField="Path" />
                </DataBindings>
            </telerik:RadTreeView>
            <asp:Panel ID="pnlNoPendingPosts" CssClass="ImportantText" Visible="false" runat="server">
                There are currently no posts set up. <asp:HyperLink ID="lnkCreateFirst" NavigateUrl="Create.aspx" runat="server">Click Here</asp:HyperLink> to create the first post.
            </asp:Panel>
            <asp:Panel ID="pnlNoPosts" CssClass="ImportantText" Visible="false" runat="server">
                There are currently no published posts set up. Publish some pending posts first.
            </asp:Panel>
        </acms:DoubleColumn>
        <acms:SingleColumn ID="colRight" runat="server">
            <b>Preview the Site</b>
            <p>Select the date you wish to preview the site at.</p>
            <ul>
                <li><asp:HyperLink ID="lnkPending" Target="_blank" Text="Pending Version" runat="server" /></li>
                <acms:AcmsDataList ID="listPreviews" AllowPaging="false" UseAjax="false" 
                    runat="server" ondatabinding="listPreviews_DataBinding">
                    <ItemTemplate>
                        <li><asp:HyperLink ID="lnkDate" Target="_blank" Text='<%#Eval("Change", "{0:dd MMM yyyy HH:mm} Version") %>' NavigateUrl='<%#string.Concat(AcmsContext.SiteRoot, "?AcmsSV=", Server.UrlEncode(Container.DataItem.ToString())) %>' runat="server" /></li>
                    </ItemTemplate>
                </acms:AcmsDataList>
                <li><asp:HyperLink ID="lnkLive" Text="Live Version" Target="_blank" runat="server" /></li>
            </ul>
            <b>Post Positions</b>
            <p>To move posts around or change the order they are displayed in use the links bellow.</p>
            <asp:Repeater ID="lstPositions" OnItemDataBound="lstPositions_ItemDataBound" OnDataBinding="lstPositions_DataBinding" runat="server">
                <HeaderTemplate>
                    <ul> 
                        <li><asp:HyperLink ID="lnkPositionPending" Text="Pending Positions" NavigateUrl="~/Posts/Position.aspx" runat="server" /></li>
                </HeaderTemplate>
                <ItemTemplate>
                        <li><asp:HyperLink ID="lnkDate" Text='<%#Eval("Change", "{0:dd MMM yyyy HH:mm} Postions") %>' NavigateUrl='<%#string.Concat("~/Posts/Position.aspx", "?AcmsSV=", Server.UrlEncode(Container.DataItem.ToString())) %>' runat="server" /></li>
                </ItemTemplate>
                <FooterTemplate>
                        <li><asp:HyperLink ID="lnkPositionLive" Text="Live Positions" runat="server" /></li>
                    </ul>
                </FooterTemplate>
            </asp:Repeater>
<%--            <ul> 
                <li><asp:HyperLink ID="lnkPositionPending" Text="Pending Positions" runat="server" /></li>
                <acms:AcmsDataList ID="lstPosition" AllowPaging="false" UseAjax="false" 
                    runat="server" ondatabinding="lstPosition_DataBinding" OnDataBound="lstPosition_DataBound">
                    <ItemTemplate>
                        <li><asp:HyperLink ID="lnkDate" Text='<%#Eval("Change", "{0:dd MMM yyyy HH:mm} Postions") %>' NavigateUrl='<%#string.Concat(GetSiteRoot(), "?AcmsSV=", Server.UrlEncode(Container.DataItem.ToString())) %>' runat="server" /></li>
                    </ItemTemplate>
                </acms:AcmsDataList>
                <li><asp:HyperLink ID="lnkPositionLive" Text="Live Positions" runat="server" /></li>
            </ul>
--%>        </acms:SingleColumn>
    </acms:Columns>
    <acms:AcmsSiteMapDataSource ID="dsSiteMap" runat="server" />
</asp:Content>

